package pub.cleangao.memm.transport.netty.compress;

import lombok.Getter;

@Getter
public enum CompressType {


    NONE((byte) 0x00, null),
    LZ4((byte) 0x01, "lz4"),
    SNAPPY((byte) 0x02, "snappy"),
    GZIP((byte) 0x03, "gzip");

    private final byte code;
    private final String name;

    CompressType(byte code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getName(byte code) {
        for (CompressType c : CompressType.values()) {
            if (c.getCode() == code) {
                return c.name;
            }
        }
        return null;
    }

}
